<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<mat-card class="identity-provider__card" [formGroup]="configurationFormGroup">
  <h2 gioTableOfContents>Configuration</h2>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Client Id</mat-label>
    <input matInput name="configurationClientId" formControlName="clientId" required />
    <mat-error *ngIf="configurationFormGroup.get('clientId').hasError('required')">Client Id is required.</mat-error>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Client Secret</mat-label>
    <input matInput name="configurationClientSecret" type="password" formControlName="clientSecret" required />
    <mat-error *ngIf="configurationFormGroup.get('clientSecret').hasError('required')">Client Secret is required.</mat-error>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Server URL</mat-label>
    <input matInput name="configurationServerURL" type="url" formControlName="serverURL" required />
    <mat-error *ngIf="configurationFormGroup.get('serverURL').hasError('required')">Server URL is required.</mat-error>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Security domain</mat-label>
    <input matInput name="configurationDomain" formControlName="domain" required />
    <mat-error *ngIf="configurationFormGroup.get('domain').hasError('required')">Security domain is required.</mat-error>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Scopes</mat-label>
    <gio-form-tags-input placeholder="Enter a scope and press Enter" formControlName="scopes"></gio-form-tags-input>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Authentication button color</mat-label>
    <gio-form-color-input placeholder="Select color" formControlName="color"></gio-form-color-input>
  </mat-form-field>
</mat-card>

<mat-card class="identity-provider__card" [formGroup]="userProfileMappingFormGroup">
  <h2 gioTableOfContents>User profile mapping</h2>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>ID</mat-label>
    <input matInput name="userProfileMappingId" placeholder="sub" formControlName="id" required />
    <mat-error *ngIf="userProfileMappingFormGroup.get('id').hasError('required')">ID is required.</mat-error>
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>First name</mat-label>
    <input matInput name="userProfileMappingFirstname" placeholder="given_name" formControlName="firstname" />
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Last name</mat-label>
    <input matInput name="userProfileMappingLastname" placeholder="family_name" formControlName="lastname" />
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Email</mat-label>
    <input matInput name="userProfileMappingEmail" placeholder="email" formControlName="email" />
  </mat-form-field>

  <mat-form-field class="identity-provider__card__form-field" appearance="fill">
    <mat-label>Picture</mat-label>
    <input matInput name="userProfileMappingPicture" placeholder="picture" formControlName="picture" />
  </mat-form-field>
</mat-card>
